package com.cta.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "cta_site")
public class Site implements BaseEntity {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "cta_site_seq")
	@SequenceGenerator(name = "cta_site_seq", sequenceName = "cta_site_seq")
	@Column(name = "id", unique = true, nullable = false)
	private Long id;

	@Column(name = "name", unique = true, nullable = false)
	private String name;

	@Column(name = "description")
	private String description;

	private Long parentId;
	
	@Column(name = "admin_id")
	private Long adminId;
	
	@Transient
	private List<BaseEntity> children;

	public Site() {}
	
	public Site(String name, String description, Long parentId) {
		this.name = name;
		this.description = description;
		this.parentId = parentId;
	}
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public Long getAdminId() {
		return adminId;
	}

	public void setAdminId(Long adminId) {
		this.adminId = adminId;
	}

	public List<BaseEntity> getChildren() {
		return children;
	}

	public void setChildren(List<BaseEntity> children) {
		this.children = children;
	}

}
